let reg =/user/gi;
let reg2=new RegExp('user','gi')
let str='this is a good Username.'
console.log(reg.test(str));
console.log(reg2.test(str));